/*
	Name:T2
	Copyright:Take it at will
	Author:Rodney
	Date: 
	Description:
*/
#include<stdio.h>
#include<stdlib.h>

int main(int argc,char *argv[])
{
	FILE *fp1,*fp2,*fp3;
	char str[256];
	
	if(argc!=4)
	{
		puts("please inout correctly");
		exit(0);
	}
	if((fp1 = fopen(argv[1],"r")) == NULL ||(fp2 = fopen(argv[2],"r")) == NULL ||(fp3 = fopen(argv[3],"w")) == NULL)
	{
		puts("fail to open the file");
		exit(0);
	}
	while(fgets(str,256,fp1) != NULL)
		fputs(str,fp3);
	while(fgets(str,256,fp2) != NULL)
		fputs(str,fp3);
	fclose(fp1);fclose(fp2);fclose(fp3);
	
	if((fp3 = fopen(argv[3],"r")) == NULL)
	{
		puts("fail to open the file");
		exit(0);
	}
	while(fgets(str,256,fp3) != NULL)
		printf("%s",str);
	
	fclose(fp3);
}

